package com.demo.shiroDemo.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;

public class FilterB implements Filter {

	public FilterB() {
		System.out.println("new FilterB()");
	}

	@Override
	public void destroy() {
	}

	@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
			throws IOException, ServletException {
		System.out.println("FilterB begin");
		// pass the request along the filter chain
//		chain.doFilter(request, response);
		((HttpServletResponse)response).sendRedirect("https://www.baidu.com/");
		System.out.println("FilterB end");
	}

	@Override
	public void init(FilterConfig fConfig) throws ServletException {
		System.out.println("FilterB init");
	}

}
